﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class CharacterPage : MonoBehaviour
{
    public Button returnBtn;
    public Text hp;
    public Text mp;
    public Text attack;
    public Text defense;

    public void OnShow()
    {
        returnBtn.onClick.AddListener(() => {
            UIManager.Instance.ShowPage(UINames.DongfuPage);
            MessageCenter.Instance.SendMessage(MessageConsts.SHOW_DONG_FU);
        });

        RefreshPage();
    }

    public void OnHide()
    {
        returnBtn.onClick.RemoveAllListeners();
    }

    private void RefreshPage()
    {
        hp.text = "气血:" + CharacterModel.Instance.Hp;
        mp.text = "法力:" + CharacterModel.Instance.Mp;
        attack.text = "攻击:" + CharacterModel.Instance.Attack;
        defense.text = "防御:" + CharacterModel.Instance.Defense;
    }
}
